home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 7 / Apprentice-Release7.iso / Environments / Clean 1.2.4 / IOInterface / dialogUpdate.icl < prev    next >
Encoding:
Modula Implementation  |  1997-01-30  |  2.3 KB  |  51 lines  |  [TEXT/3PRM]

  1. implementation module dialogUpdate;
  2.  
  3.  
  4. import StdClass; // RWS
  5. import    StdBool, StdInt, StdString, StdChar;
  6. import    OS_utilities, quickdraw, menus, events, windows, dialogs;
  7. import    dialogAccess, dialogInternal, dialogAbout, ioState;
  8.  
  9.  
  10. DialogUpdateError :: String String -> .x;
  11. DialogUpdateError f error = Error f "dialogUpdate" error;
  12.  
  13. //    Handle dialog updates (i.e. redraw Controls and IconButtons).
  14.  
  15. ForceDialogUpdate :: !(DialogRep s (IOState s)) !Toolbox -> Toolbox;
  16. ForceDialogUpdate dRep=:(DialogH id tt md rect ps is rt, dPtr) tb
  17.     =    UpdateDialog dRep (InGrafport2 dPtr (ValidRect rect) tb2);
  18.     where {
  19.         (tickCount,        tb1) = TickCount tb;
  20.         (b,dPtr1,itemNr,tb2) = DialogSelect (UpdateEvent, dPtr, tickCount, 0, 0, 1) tb1;
  21.     };
  22.  
  23. UpdateDialog :: !(DialogRep s (IOState s)) !Toolbox -> Toolbox;
  24. UpdateDialog (DialogH _ _ _ _ popUpHs items (DialogRest _ _ defId), ptr) tb
  25.     =    UpdateItems defId popUpHs items ptr tb;
  26.  
  27. UpdateItems :: !DialogItemId ![PopUpHandle] ![DialogItem s (IOState s)] !DialogPtr !Toolbox -> Toolbox;
  28. UpdateItems defid popups [DialogButton id box tt ab bf : rest] ptr tb
  29. |    defid == id = UpdateItems defid popups rest ptr (DrawDefButtonOutline box ptr tb);
  30.                 = UpdateItems defid popups rest ptr tb;
  31. UpdateItems defid popups [DialogIconButton id box domain look select bf : rest] ptr tb
  32.     =    UpdateItems defid popups rest ptr (RedrawIconOrControl box domain (look select) ptr tb);
  33. UpdateItems defid popups [Control id box domain select state look cf df : rest] ptr tb
  34.     =    UpdateItems defid popups rest ptr (RedrawIconOrControl box domain (look select state) ptr tb);
  35. UpdateItems defid popups [DialogPopUp id box select di buts : rest] ptr tb
  36.     =    UpdateItems defid popups rest ptr (RedrawPopUp box select itemtext ptr tb);
  37.     where {
  38.         (itemtext,ab,df)= GetRadioButtonInfo di buts;
  39.         (i,m)           = GetPopUpHandle id popups;
  40.     };
  41. UpdateItems defid popups [item : rest] ptr tb = UpdateItems defid popups rest ptr tb;
  42. UpdateItems _ _ _ _ tb = tb;
  43.  
  44. GetRadioButtonInfo :: !DialogItemId ![RadioItemDef s (IOState s)]
  45.     -> (!ItemTitle, !SelectState, !DialogFunction s (IOState s));
  46. GetRadioButtonInfo bid [RadioItem id title ab df : rest]
  47. |    bid == id    = (title,ab,df);
  48.                 = GetRadioButtonInfo bid rest;
  49. GetRadioButtonInfo bid _
  50.     =    DialogUpdateError "GetRadioButtonInfo" ("Unknown item id: " +++ toString bid);
  51.